package com.xcdh;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * Hello world!
 *
 */
@SpringBootApplication
@EnableScheduling
public class App
{
    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext app = SpringApplication.run(App.class, args);
        // 获取本机IP
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = app.getEnvironment().getProperty("server.port");
        String appName = app.getEnvironment().getProperty("spring.application.name");
        System.out.printf("服务%s 启动成功 http://%s:%s%n",appName,ip,port);

    }
}
